Skip to content

Added support for isContentEditable#234

Open
skygate2012 wants to merge 2 commits intoninja33:masterfrom
skygate2012:master
Open

Added support for isContentEditable#234
skygate2012 wants to merge 2 commits intoninja33:masterfrom
skygate2012:master

Conversation

@skygate2012
Copy link
Contributor

@skygate2012 skygate2012 commented Mar 25, 2022

Some webpages (YouTube comments for example) use <div> as text input so isContentEditable needs be checked in addition.

Relevant minor changes:

  • Allowed double click to trigger popup in text input elements since it won't interfere with text editing like hotkeys do.
  • Added a mouse point save before getTranslation() to avoid the triggered popup displaying in somewhere else when the network is slow and the mouse is moved.
  • Added condition for the timeout to prevent triggering onSelectionEnd if there's no text selected.

Some webpages (Youtube comments for example) use <div> as text input so isContentEditable needs be checked in addition.

Relevant minor changes:
- Allowed double click to trigger popup in text input elements since it won't interfere with text editing like hotkeys do.
- Added a mouse point save before getTranslation() to avoid the triggered popup displaying in somewhere else when the network is slow and the mouse is moved.
- Rectified `exitKey` not being verified (my bad).
- Added condition for the timeout to prevent triggering `onSelectionEnd` if there's no text selected.
@skygate2012
Copy link
Contributor Author

@ninja33 Hi, can you review this? These are small but critical fixes. I have been using my custom fork because of this one change. More and more websites/apps are using custom elements (some even web components) with contenteditable=true these days.

@ninja33
Copy link
Owner

ninja33 commented Mar 14, 2025

@ninja33 Hi, can you review this? These are small but critical fixes. I have been using my custom fork because of this one change. More and more websites/apps are using custom elements (some even web components) with contenteditable=true these days.

upon some users feedback, when selected text in editable area, the extension will crash. so in the very early version, I just simply disabled it. if you are fully tested this case without issue, I am OK.

btw, because it's PR before 3 years, please help submit a new PR upon branch manifest-v3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants